﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using EzDesk.Apps.Model.ProjectModule;
using EzDesk.EzAppApi.Utility;

namespace EzDesk.Clients.DesktopWeb.ViewModels
{
    public static class WorkitemEx 
    {
        public static Workitem PopulateCreatorNameAndOwnerName(this Workitem workitem)
        {
            if (workitem.OwnerId.HasValue)
                workitem.OwnerName = CacheableEzApiClient.Instance.GetSimpleUserById(workitem.OwnerId.Value).Name;

            workitem.CreatorName = CacheableEzApiClient.Instance.GetSimpleUserById(workitem.CreatorId).Name;
            return workitem;
        }

    }
}
